libxl: libxl__xs_write format string should be const.
authorIan Campbell <ian.campbell@citrix.com>
Tue, 24 May 2011 16:12:27 +0000 (17:12 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 24 May 2011 16:12:27 +0000 (17:12 +0100)
George Dunlap reports that gcc 4.4.3 complains:
  libxl_dm.c: In function libxl__create_device_mode:
  libxl_dm.c:776: error: format not a string literal and no format arguments
And indeed the format argument here is a char * from libxl__domain_bios().

Make the argument to libxl__xs_write a const char * and change
libxl__domain_bios to return a const char too.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_dm.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_xshelp.c

index 7a81cbfe2696233fbd3307f4561cc037d53d5e32..1ba7fe5b5eef29ea1858a9914f9da3ec8a8dca5d 100644 (file)
@@ -68,12 +68,12 @@ const char *libxl__domain_device_model(libxl__gc *gc,
     return dm;
 }
 
-static char *libxl__domain_bios(libxl__gc *gc,
+static const char *libxl__domain_bios(libxl__gc *gc,
                                 libxl_device_model_info *info)
 {
     switch (info->device_model_version) {
-    case 1: return libxl__strdup(gc, "rombios");
-    case 2: return libxl__strdup(gc, "seabios");
+    case 1: return "rombios";
+    case 2: return "seabios";
     default:return NULL;
     }
 }
index 8d25ef48a21359cf367e00162ea38fa36452cf44..b032e7fa8ec642bbf4e930ab136fa2b3bc8f76c5 100644 (file)
@@ -153,7 +153,7 @@ _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int
 _hidden int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t,
                     char *dir, char **kvs);
 _hidden int libxl__xs_write(libxl__gc *gc, xs_transaction_t t,
-                   char *path, char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
+                   char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
    /* Each fn returns 0 on success.
     * On error: returns -1, sets errno (no logging) */
 
index 3dc9239bcbcca8fd98f911fb314db6ac149635d9..1df377c7075adeb9aa1c023b0cee60577b08423b 100644 (file)
@@ -69,7 +69,7 @@ int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t,
 }
 
 int libxl__xs_write(libxl__gc *gc, xs_transaction_t t,
-                   char *path, char *fmt, ...)
+                   char *path, const char *fmt, ...)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *s;